<template>
    <div>
        <City-Header></City-Header>
        <City-List :hotCities="hotCities" :cities="cities"></City-List>
    </div>
</template>

<script>
import axios from 'axios'
import CityHeader from './components/Header'
import CityList from './components/List'
export default{
  name: 'City',
  data: function () {
    return {
      hotCities: [],
      cities: {}
    }
  },
  components: {
    CityHeader: CityHeader,
    CityList: CityList
  },
  methods: {
    getCityInfo: function () {
      axios.get('http://localhost:8080/static/mock/city.json')
        .then(this.getCityInfoSuccess)
    },
    getCityInfoSuccess: function (res) {
      let data = res.data.data
      this.hotCities = data.hotCities
      this.cities = data.cities
    }
  },
  mounted: function () {
    this.getCityInfo()
  }
}
</script>

<style lang="stylus" scoped>

</style>
